<template>
  <div>
    <h1>Home</h1>
    <a href="javascript:;" @click="logout">退出登陆</a>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router';
import { useStorage } from './hooks/user';

const router = useRouter();
const { removeUserStorage } = useStorage();

const logout = () => {
  //清空localStorage
  removeUserStorage();
  //跳转至登陆页面
  router.push('/login');
};
</script>
